#include"Camera.h"

Camera::Camera()
{	
capture = 0;
frame = 0;
capture=cvCreateCameraCapture(0);
}

IplImage* Camera::GetFrame()
{ 
	/* always check */
    if ( !capture ) {
        fprintf( stderr, "Cannot open initialize webcam!\n" );
     
    }
//return the image
 return  frame=cvRetrieveFrame(capture);
}
void Camera::SaveFrame()
{
 cvSaveImage("my-photo.jpg",frame);
}
Camera::~Camera()
{
cvReleaseCapture( &capture );
}